#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N = 55;
const int M = 1e9 + 7;

int t, n;


int main() {
#ifdef LOCAL
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif
    ios::sync_with_stdio(false), cin.tie(0);
    cin >> t;
    while (t--) {
        cin >> n;

        for (int i = 0; i < n; i++) {
            string res;

            for (int k = 0; k < i; k++) res += "()";
            for (int k = 0; k < n - i; k++) res += "(";
            for (int k = 0; k < n - i; k++) res += ")";

            cout << res << endl;
        }
    }
    return 0;
}